﻿using System.ComponentModel;
using System.Windows;
using System.Windows.Controls;

namespace Koala.Pro.Common.Extension
{
    public static class ControlExtensions
    {
        public static bool IsInDesignMode(this Control control)
        {
            return DesignerProperties.GetIsInDesignMode(control);
        }

        public static void ToVisibility(this Button control, bool visible = false)
        {
            control.Visibility = ((!visible) ? Visibility.Collapsed : Visibility.Visible);
        }

        public static void ToVisibility(this UIElement control, bool visible = false)
        {
            control.Visibility = ((!visible) ? Visibility.Collapsed : Visibility.Visible);
        }
    }
}
